cmake_minimum_required (VERSION 3.0.0)

project (deamon-ipc)

if(NOT DEFINED env)
    set(env "wsl")
endif()

file(GLOB MY_SOURCE_DIR 
    ${PROJECT_SOURCE_DIR}/deamon-ipc.c
    ${PROJECT_SOURCE_DIR}/queue.c
    ${CMAKE_SOURCE_DIR}/src/cjson/cjson.c
    ${CMAKE_SOURCE_DIR}/src/ly/elog/*.c
    ${CMAKE_SOURCE_DIR}/src/ly/ipc/*.c)

set(MY_INCLUDE_DIR 
    ${CMAKE_SOURCE_DIR}/inc
    ${CMAKE_SOURCE_DIR}/inc/cjson
    ${CMAKE_SOURCE_DIR}/inc/ly/elog
    ${CMAKE_SOURCE_DIR}/inc/ly/ipc
    ${PROJECT_SOURCE_DIR})

message(STATUS "Adding include dir: ${CMAKE_SOURCE_DIR}")
message(STATUS "Adding include dir: ${CMAKE_CURRENT_SOURCE_DIR}")
include_directories (${MY_INCLUDE_DIR})


LINK_LIBRARIES(-lm -lpthread -pthread -lpthread)

add_executable(deamon-ipc ${MY_SOURCE_DIR})

# message(STATUS "2222 ${ZLOG_LIB}")
# target_link_libraries (main ${ZLOG_LIB})
target_link_libraries (deamon-ipc ${CMAKE_SOURCE_DIR}/lib/zlog/${env}/libzlog.so)

# PROJECT_SOURCE_DIR
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)


set(MY_INCLUDE_DIR 
    ./inc
    ${PROJECT_SOURCE_DIR})

file(GLOB MY_SOURCE_DIR 
    ${PROJECT_SOURCE_DIR}/deamon.c
    ${PROJECT_SOURCE_DIR}/queue.c)

include_directories (${MY_INCLUDE_DIR})

LINK_LIBRARIES(-lm -lpthread -pthread)

add_executable(deamon ${MY_SOURCE_DIR})

target_link_libraries (deamon ${CMAKE_SOURCE_DIR}/lib/zlog/${env}/libzlog.so)

# PROJECT_SOURCE_DIR
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)